<?php
//dezend by http://www.yunlu99.com/ QQ:270656184
defined('BASEPATH') || exit('No direct script access allowed');
?><link rel="stylesheet" type="text/css" href="/static/css/upload.css">
<form id="ff" method="post" style="margin:10px 0px 0px 10px;display:block;">
	<input type="hidden" name="id" value="<?php echo $id;?>">
	<table style="font-size:12px;" cellspacing="5">
		<tr>
			<td>用户ID</td>
			<td><input type="text" class="easyui-validatebox" name="user_id" value="<?php echo $user_id;?>"></td>
		</tr>
		<tr>
			<td>项目名称</td>
			<td><input type="text" class="easyui-validatebox" name="name" value="<?php echo $name;?>"></td>
		</tr>
		<tr>
			<td>项目简介</td>
			<td><input type="text" class="easyui-validatebox" name="intro" value="<?php echo $intro;?>"></td>
		</tr>
		<tr>
			<td>项目天数</td>
			<td><input type="text" class="easyui-validatebox" name="day" value="<?php echo $day;?>" required="true"></td>
		</tr>
		<tr>
			<td>开始时间</td>
			<td><input type="text" class="easyui-datebox" name="begin" value="<?php echo date('Y-m-d', $begin);?>" required="true"></td>
		</tr>
		<tr>
			<td>结束时间</td>
			<td><input type="text" class="easyui-datebox" name="end" value="<?php echo date('Y-m-d', $end);?>" required="true"></td>
		</tr>
		<tr>
			<td>项目LOGO</td>
			<td>
				<div id="logo_view" class="upload_view"><img src="/upload/item/<?php echo $logo;?>"></div>
				<input type="hidden" name="logo" id="logo_value" value="<?php echo $logo;?>">
				<input type="file" id="logo_file"><button type="button" id="logo">上传</button>
			</td>
		</tr>
		<tr>
			<td>项目图片</td>
			<td>
				<div id="img_view" class="upload_view"><img src="/upload/item/<?php echo $img;?>"></div>
				<input type="hidden" name="img" id="img_value" value="<?php echo $img;?>">
				<input type="file" id="img_file"><button type="button" id="img">上传</button>
			</td>
		</tr>
		<tr>
			<td>详细介绍</td>
			<td><textarea name="content" cols=150 rows=30><?php echo $content;?></textarea></td>
		</tr>
		<tr>
			<td>代币名称</td>
			<td>
			<select name="db_id">
			
<?php
foreach ($db_coins as $v) {
?>			<option value="<?php echo $v['id'];?>" 
<?php
	if ($db_id == $v['id']) {
?>selected<?php
	}

?>><?php echo $v['en_name'];?></option>
			<?php
}

?>			</select>
			 项目发布者发行的币</td>
		</tr>
		<tr>
			<td>代币总量</td>
			<td><input type="text" class="easyui-validatebox" name="db_total" value="<?php echo $db_total;?>"> 项目发布者发行的币</td>
		</tr>
		
		<tr>
			<td>目标金额</td>
			<td><input type="text" class="easyui-validatebox" name="target_amount" value="<?php echo $target_amount;?>"></td>
		</tr>
		<tr>
			<td>资金类型</td>
			<td>
				<select name="coin_id">
				  
<?php
foreach ($coins as $v) {
?>				  <option value="<?php echo $v['id'];?>" 
<?php
	if ($coin_id == $v['id']) {
?>selected<?php
	}

?>><?php echo $v['cn_name'];?></option>
				  <?php
}

?>				</select>
			</td>
		</tr>
		<tr>
			<td>兑换比率</td>
			<td>1 代币 = <input type="text" class="easyui-validatebox" name="db_rate" value="<?php echo $db_rate;?>"></td>
		</tr>
		<tr>
			<td>回报周期</td>
			<td><input type="text" class="easyui-validatebox" name="repay_day" value="<?php echo $repay_day;?>"></td>
		</tr>
		<tr><th>项目白皮书：</th>
	  	    <td>
				<div id="book_view">
<?php
if ($book) {
?><a href="/upload/item/<?php echo $book;?>" target="_blank" class="easyui-linkbutton" iconCls="icon-search">点击查看</a><?php
}

?></div>
				<input type="hidden" name="book" id="book_value">
				<input type="file" id="book_file"><button type="button" id="book">上传</button>
		    </td>
	    </tr>
	    <tr><th>允许超额：</th><td><input type="radio" name="is_over" value="0" 
<?php
if ($is_over == 0) {
?>checked<?php
}

?>> 否   <input type="radio" name="is_over" value="1" 
<?php
if ($is_over == 1) {
?>checked<?php
}

?>> 是 </td></tr>
		<tr><th>允许锁定：</th><td><input type="radio" name="is_lock" value="0" 
<?php
if ($is_lock == 0) {
?>checked<?php
}

?>> 否   <input type="radio" name="is_lock" value="1" 
<?php
if ($is_lock == 1) {
?>checked<?php
}

?>> 是 </td></tr>
		<tr><th>锁定后允许投资：</th><td><input type="radio" name="is_lock_support" value="0" 
<?php
if ($is_lock_support == 0) {
?>checked<?php
}

?>> 否   <input type="radio" name="is_lock_support" value="1" 
<?php
if ($is_lock_support == 1) {
?>checked<?php
}

?>> 是 </td></tr>
		<tr>
			<td></td>
			<td>
			<button type="submit" class="easyui-linkbutton" iconCls="icon-ok">提交</button>
			</td>
		</tr>
	</table>
</form>

<script language="javascript">
$(function(){

	$('#ff').form({
		url:'<?php echo site_url('items/update');?>',
		onSubmit:function(){
			return $(this).form('validate');
		},
		success:function(data){
			data = eval('('+data+')');
			$.messager.alert('信息提示',data.msg,'info');
			if(data.error == 0){
				$('#win').window('close');
				$('#tt').datagrid('reload');
			}
		}
	});
	
	$("#logo").upload('<?php echo site_url('items/upload');?>','/upload/item/', 'logo_file');
	$("#img").upload('<?php echo site_url('items/upload');?>','/upload/item/', 'img_file');
	$("#book").upload('<?php echo site_url('items/upload');?>','/upload/item/', 'book_file');

});
</script>
<link rel="stylesheet" href="/static/plugin/kindeditor/themes/default/default.css" />
<script charset="utf-8" src="/static/plugin/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="/static/plugin/kindeditor/lang/zh_CN.js"></script>

<script language="javascript">
$(function(){
	KindEditor.create('[name="content"]', {
		resizeArt : 1,
		allowPreviewEmoticons : false,
		allowImageUpload : true,
		afterBlur: function(){this.sync();},
		items : [
			'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
			'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
			'insertunorderedlist', '|', 'image', 'link']
    });
});
</script>